# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

from pkg_resources import parse_version
import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO


if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
    raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__))

class ArsParseDetection(KaitaiStruct):
    def __init__(self, _io, _parent=None, _root=None):
        self._io = _io
        self._parent = _parent
        self._root = _root if _root else self
        self._read()

    def _read(self):
        self.header = ArsParseDetection.HeaderStr(self._io, self, self._root)
        self.body = ArsParseDetection.DetectionList(self._io, self, self._root)

    class HeaderStr(KaitaiStruct):
        def __init__(self, _io, _parent=None, _root=None):
            self._io = _io
            self._parent = _parent
            self._root = _root if _root else self
            self._read()

        def _read(self):
            self.service_id = self._io.read_u2be()
            self.method_id = self._io.read_u2be()
            self.length = self._io.read_u4be()
            self.client_id = self._io.read_u2be()
            self.session_id = self._io.read_u2be()
            self.protocol_version = self._io.read_u1()
            self.interface_version = self._io.read_u1()
            self.message_type = self._io.read_u1()
            self.return_code = self._io.read_u1()


    class DetectionList(KaitaiStruct):
        def __init__(self, _io, _parent=None, _root=None):
            self._io = _io
            self._parent = _parent
            self._root = _root if _root else self
            self._read()

        def _read(self):
            self.crch = self._io.read_u4be()
            self.crcl = self._io.read_u4be()
            self.length = self._io.read_u4be()
            self.sqc = self._io.read_u4be()
            self.data_id = self._io.read_u4be()
            self.timestamp_nanoseconds = self._io.read_u4be()
            self.timestamp_seconds = self._io.read_u4be()
            self.timestamp_sync_status = self._io.read_u1()
            self.event_data_qualifier = self._io.read_u4be()
            self.extended_qualifier = self._io.read_u1()
            self.origin_invalidflags = self._io.read_u2be()
            self.origin_xpos = self._io.read_f4be()
            self.origin_xstd = self._io.read_f4be()
            self.origin_ypos = self._io.read_f4be()
            self.origin_ystd = self._io.read_f4be()
            self.origin_zpos = self._io.read_f4be()
            self.origin_zstd = self._io.read_f4be()
            self.origin_roll = self._io.read_f4be()
            self.origin_rollstd = self._io.read_f4be()
            self.origin_pitch = self._io.read_f4be()
            self.origin_pitchstd = self._io.read_f4be()
            self.origin_yaw = self._io.read_f4be()
            self.origin_yawstd = self._io.read_f4be()
            self.list_invalidflags = self._io.read_u1()
            self.list_detections = [None] * (800)
            for i in range(800):
                self.list_detections[i] = ArsParseDetection.DetectionStr(self._io, self, self._root)

            self.list_radveldomain_min = self._io.read_f4be()
            self.list_radveldomain_max = self._io.read_f4be()
            self.list_numofdetections = self._io.read_u4be()
            self.aln_azimuthcorrection = self._io.read_f4be()
            self.aln_elevationcorrection = self._io.read_f4be()
            self.empty = []
            i = 0
            while not self._io.is_eof():
                self.empty.append(self._io.read_u1())
                i += 1



    class ObjectList(KaitaiStruct):
        def __init__(self, _io, _parent=None, _root=None):
            self._io = _io
            self._parent = _parent
            self._root = _root if _root else self
            self._read()

        def _read(self):
            self.empty = []
            i = 0
            while not self._io.is_eof():
                self.empty.append(self._io.read_u1())
                i += 1



    class DetectionStr(KaitaiStruct):
        def __init__(self, _io, _parent=None, _root=None):
            self._io = _io
            self._parent = _parent
            self._root = _root if _root else self
            self._read()

        def _read(self):
            self.f_azimuthangle = self._io.read_f4be()
            self.f_azimuthanglestd = self._io.read_f4be()
            self.u_invalidflags = self._io.read_u1()
            self.f_elevationangle = self._io.read_f4be()
            self.f_elevationanglestd = self._io.read_f4be()
            self.f_range = self._io.read_f4be()
            self.f_rangestd = self._io.read_f4be()
            self.f_rangerate = self._io.read_f4be()
            self.f_rangeratestd = self._io.read_f4be()
            self.s_rcs = self._io.read_s1()
            self.u_measurementid = self._io.read_u2be()
            self.u_positivepredictivevalue = self._io.read_u1()
            self.u_classification = self._io.read_u1()
            self.mulitargetprobability = self._io.read_u1()
            self.u_objectid = self._io.read_u2be()
            self.u_ambiguityflag = self._io.read_u1()
            self.u_sortindex = self._io.read_u2be()



